class MyNumber:
    a=0
    def __iter__(self):
        self.a =  1
        return self
    def __next__(self):
        if self.a <= 20:
            x=self.a
            self.a+=1
            return x
        else:
            raise StopIteration

if __name__ == '__main__':
    myclass=MyNumber()
    myiter=iter(myclass)

    # print(next(myiter))
    
    for x in myiter:
        print(x)
